#include <windows.h>
#include "..\helpers.h"
#include "..\FRONTEND.H"


int APIENTRY WinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPSTR     lpCmdLine,
                     int       nCmdShow)
{
	// search for Winamp main window
	HWND hwndWinamp=FindWindow("Winamp v1.x", NULL);
	if(!IsWindow(hwndWinamp)){
		// launch player
		hwndWinamp=StartPlayer();
		if(hwndWinamp==NULL)
		{
			MessageBeep(MB_ICONERROR);
			return 1;	// can't start player
		}
	}

	// play!
	PostMessage(hwndWinamp, WM_COMMAND, WINAMP_BUTTON2, 0);

	return 0;
}